package com.huizluo.module4.student;

import java.util.HashMap;

public class ListCommand extends Command {
    private Store database;

    public ListCommand(String commandName, String commandDesc, Store database) {
        super(commandName,commandDesc);
        this.database = database;
    }

    @Override
    public void notise() {

    }

    @Override
    public void run(HashMap<String, String> args) {
        Item[] items = this.database.List();
        if (items.length == 0){
            System.out.println("没有数据");
            return;
        }
        for (Item item : items) {
            Student s = (Student) item.obj;
            System.out.println(s);
        }
    }
}
